Skip to content

Conversation

0x5bfa
Copy link
Member

@0x5bfa 0x5bfa commented Aug 5, 2025

Re: #17377


Resolved / Related Issues

Steps used to test these changes

  1. Open Files app
  2. Do some file operations and check if they go successfully

@0x5bfa 0x5bfa marked this pull request as ready for review August 7, 2025 18:05
@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-StartSTA branch from 85b38eb to 59d2ed8 Compare August 7, 2025 18:06
@yaira2 yaira2 added the ready for review Pull requests that are ready for review label Aug 10, 2025
@yaira2 yaira2 force-pushed the main branch 2 times, most recently from 97999e5 to 806f922 Compare September 9, 2025 21:12
@yaira2
Copy link
Member

yaira2 commented Sep 28, 2025

@0x5bfa what's the status of this PR?

@yaira2 yaira2 added the needs - additional info Needs more information from the reporter label Sep 28, 2025
@0x5bfa
Copy link
Member Author

0x5bfa commented Sep 28, 2025

Ready for review and merge.

@yaira2
Copy link
Member

yaira2 commented Sep 29, 2025

Can you please resolve the merge conflicts and fill out the PR template? Thank you.

@yaira2 yaira2 removed the needs - additional info Needs more information from the reporter label Sep 29, 2025
@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-StartSTA branch 2 times, most recently from ecf7f65 to 7e950b5 Compare September 30, 2025 03:44
@yaira2 yaira2 requested a review from Copilot October 19, 2025 03:43
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the codebase by replacing custom Win32Helper.StartSTATask helper methods with the new STATask.Run API. The change standardizes STA (Single-Threaded Apartment) task execution throughout the application and removes the deprecated helper methods.

Key Changes:

  • Replaced all Win32Helper.StartSTATask calls with STATask.Run across the codebase
  • Removed the four StartSTATask method overloads from Win32Helper.Storage.cs
  • Updated STATask.Run methods to require a non-nullable ILogger parameter and removed redundant exception propagation

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
QuickAccessWidgetViewModel.cs Added logger parameter to STATask.Run calls for pin/unpin operations
FileOperationsHelpers.cs Migrated 10 Win32Helper.StartSTATask calls to STATask.Run with logger
FileThumbnailHelper.cs Updated icon loading methods to use STATask.Run
LaunchHelper.cs Replaced StartSTATask calls in application launch handlers
LibraryManager.cs Migrated library management operations to STATask.Run
WindowsQuickAccessService.cs Updated quick access unpin operations to use STATask.Run
StorageTrashBinService.cs Replaced StartSTATask in trash restoration logic
StorageNetworkService.cs Migrated network operations to STATask.Run
Win32Helper.Storage.cs Removed four deprecated StartSTATask method overloads
Win32Helper.Shell.cs Updated shell enumeration to use STATask.Run
STATask.cs Made logger parameter required and removed duplicate exception handling
WindowsStorableHelpers.Icon.cs Added null logger parameter to STATask.Run call

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

HRESULT hr = storable.TryGetThumbnail(size, options, out var thumbnailData).ThrowIfFailedOnDebug();
return thumbnailData;
});
}, null);
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing null for the logger parameter is inconsistent with other calls in this PR that use App.Logger. This means exceptions in thumbnail operations won't be logged, making debugging harder. Consider passing a logger instance here for consistency.

Suggested change
}, null);
}, App.Logger);

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0x5bfa fyi

/// <param name="action">The work to execute in the STA thread.</param>
/// <param name="logger">A logger to capture any exception that occurs during execution.</param>
/// <returns>A <see cref="Task"/> that represents the work scheduled to execute in the STA thread.</returns>
public static Task Run(Action action, ILogger? logger)
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logger parameter is marked as nullable (ILogger?) but is now required based on all call sites passing App.Logger. This creates ambiguity in the API contract. Consider making it non-nullable if it's intended to be required, or provide a default parameter value if null is acceptable.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Pull requests that are ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants